// components/NavBar/NavBar.js
const app = getApp()

Component({
    options: {
        multipleSlots: true
    },
    data: {
        customNav: app.globalData.customNav,
        isMainPage: false, //是否显示回退按钮
        themeData: {
            light: {
                bg: '#FBC600',
                font: '#333'
            },
            dark: {
                bg: '#292c35',
                font: '#fff'
            },
            white: {
                bg: '#fff',
                font: '#333'
            },
            green: {
                bg: '#3cb373',
                font: '#fff'
            },
        }
    },

    properties: {
        title: {
            type: String,
            value: ''
        },
        theme: {
            type: String, // light - dark - white
            value: 'dark',
        },
        loading: {
            type: Boolean,
            value: false
        }
    },

    lifetimes: {
        attached() {
            this.setData({
                isMainPage: getCurrentPages().length <= 1
            })
        }
    },

    methods: {
        goBackPage() {
            wx.navigateBack({
                delta: 1
            })
        },
        titleBt() {
            this.triggerEvent("title-bt")
        }
    }
})